using System;
using System.Collections.Generic;

using EntModApp.EntServices.Data;

namespace DemoApp.DataAccess 
{
  public static class SecurableActionPropertyNames
  {
    public const string SecurableActionId = @"SecurableActionId"; 

    public const string Name = @"Name"; 

  }

  public static class SecurableActionReferenceNames
  {
    public const string Roles = @"Roles"; 

  }

  [Serializable]
  public partial class SecurableActionLoadSettings 
  {

    public SecurableActionLoadSettings()
    {
      AsReadonly = false;

      OnCreate();
    }

    public bool AsReadonly { get; set; }

    private SecurableActionFilterExpression filter;
    public SecurableActionFilterExpression Filter 
    { 
      get 
      { 
        filter = SecurableActionFilterExpression.FromSecurableActionFilterExpression(filter);
        return filter; 
      }
      set { filter = value; }
    }

    private SecurableActionSelectionSettings selection;
    public SecurableActionSelectionSettings Selection 
    { 
      get 
      { 
        selection = SecurableActionSelectionSettings.FromSecurableActionSelectionSettings(selection);
        return selection; 
      }
      set { selection = value; }
    }

    private SecurableActionInclusionSettings inclusion;
    public SecurableActionInclusionSettings Inclusion 
    { 
      get 
      { 
        inclusion = SecurableActionInclusionSettings.FromSecurableActionInclusionSettings(inclusion);
        return inclusion; 
      }
      set { inclusion = value; }
    }

    private SecurableActionSortingSettings sorting;
    public SecurableActionSortingSettings Sorting 
    { 
      get 
      { 
        sorting = SecurableActionSortingSettings.FromSecurableActionSortingSettings(sorting);
        return sorting; 
      }
      set { sorting = value; }
    }

    private PagingSettings paging;
    public PagingSettings Paging 
    { 
      get 
      { 
        if (paging == null) paging = new PagingSettings();
        return paging; 
      }
      set { paging = value; }
    }

    partial void OnCreate();

    protected virtual void CopyFrom(SecurableActionLoadSettings other)
    {
      if (other != null)
      {
        filter     = other.filter;
        selection  = other.selection;
        sorting    = other.sorting;
        inclusion  = other.inclusion;
        paging     = other.paging;
      }
    }

    public static SecurableActionLoadSettings FromSecurableActionLoadSettings(SecurableActionLoadSettings other)
    {
      if (other != null) return other;
      var result = new SecurableActionLoadSettings();
      return result;
    }

  }

  [Serializable]
  public partial class SecurableActionFilterExpression 
  {
    public SecurableActionKey ByKey { get; set; }

    public int? Skip { get; set; }

    public int? Take { get; set; }

    public SimpleFilterExpression<Guid> SecurableActionIdFilter { get; set; }

    public SimpleFilterExpression<string> NameFilter { get; set; }

    partial void OnCreate();

    protected virtual void CopyFrom(SecurableActionFilterExpression other)
    {
      if (other != null)
      {
        ByKey = other.ByKey;
        Skip = other.Skip;
        Take = other.Take;
      }
    }

    public static SecurableActionFilterExpression FromSecurableActionFilterExpression(SecurableActionFilterExpression other)
    {
      if (other != null) return other;
      var result = new SecurableActionFilterExpression();
      return result;
    }

  }

  [Serializable]
  public partial class SecurableActionSelectionSettings 
  {
    public SecurableActionSelectionSettings()
    {
      SelectSecurableActionId = true;
      SelectName = true;

      OnCreate();
    }

    public bool SelectSecurableActionId { get; set; } 

    public bool SelectName { get; set; } 

    partial void OnCreate();

    protected virtual void CopyFrom(SecurableActionSelectionSettings other)
    {
      if (other != null)
      {
        SelectSecurableActionId = other.SelectSecurableActionId;
        SelectName = other.SelectName;
      }
    }

    public static SecurableActionSelectionSettings FromSecurableActionSelectionSettings(SecurableActionSelectionSettings other)
    {
      if (other != null) return other;
      var result = new SecurableActionSelectionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class SecurableActionInclusionSettings 
  {
    public SecurableActionInclusionSettings()
    {
      OnCreate();
    }

    public bool IncludeRoles { get; set; }
    private RoleLoadSettings includedRolesSettings;
    public RoleLoadSettings IncludedRolesSettings 
    { 
      get
      {
        includedRolesSettings = RoleLoadSettings.FromRoleLoadSettings(includedRolesSettings);
        return includedRolesSettings;
      } 
      set
      {
        includedRolesSettings = value;
      }
    }


    partial void OnCreate();

    protected virtual void CopyFrom(SecurableActionInclusionSettings other)
    {
      if (other != null)
      {
        IncludeRoles = other.IncludeRoles;
        includedRolesSettings = other.includedRolesSettings;
      }
    }

    public static SecurableActionInclusionSettings FromSecurableActionInclusionSettings(SecurableActionInclusionSettings other)
    {
      if (other != null) return other;
      var result = new SecurableActionInclusionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class SecurableActionSortingSettings 
  {
    public SecurableActionSortingSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected virtual void CopyFrom(SecurableActionSortingSettings other)
    {
      if (other != null)
      {
      }
    }

    public static SecurableActionSortingSettings FromSecurableActionSortingSettings(SecurableActionSortingSettings other)
    {
      if (other != null) return other;
      var result = new SecurableActionSortingSettings();
      return result;
    }

  }
}
